angular.module("myApp")
.controller("HomeController",["$scope","HomeService",
    function($scope,HomeService){
        HomeService.getData().success(function(res){
            $scope.list = res[0].subCateList
        })
}])
//控制计时器的函数
.controller("oclock",["$scope",function($scope){
(function(hh,h,mm,m,ss,s){
		var i = s
		var _hh = document.getElementById("hh"),
		_h = document.getElementById("h"),
		_mm = document.getElementById("mm"),
		_m = document.getElementById("m"),
		_ss = document.getElementById("ss"),
		_s = document.getElementById("s");
		_hh.src = "img/home/数字"+hh+".png";
		_h.src = "img/home/数字"+h+".png";
		_mm.src = "img/home/数字"+mm+".png";
		_m.src = "img/home/数字"+m+".png";
		_ss.src = "img/home/数字"+ss+".png";
		_s.src = "img/home/数字"+s+".png";
		var timer = window.setInterval(function(){
			if(i == 0){
				s = 0
				_s.src = "img/home/数字"+s+".png";
			}else if(i<0){
				s = 9;
				i = 9;
				_s.src = "img/home/数字"+s+".png";
			}else{
				s = s - 1;
				_s.src = "img/home/数字"+s+".png";
			};
			//=====
			if(s == 9){
				ss = ss - 1;
				if(ss < 0){
					ss = 5
					m = m - 1;
					if(m < 0){
						m = 9;
						mm = mm - 1;
						if(mm < 0){
							mm = 5;
							h = h - 1;
							if(h < 0){
								h = 9
								hh = hh - 1;
								if(hh < 0){
									hh = 2;
									h = 3;
									if( hh == 0 && h == 0 && mm == 0 && m == 0 && ss == 0 && s == 0){
										clearInterval(timer)
										_hh.src = "img/home/数字"+0+".png";
										_h.src = "img/home/数字"+0+".png";
										_mm.src = "img/home/数字"+0+".png";
										_m.src = "img/home/数字"+0+".png";
										_ss.src = "img/home/数字"+0+".png";
										_s.src = "img/home/数字"+0+".png";
									}
								}
								_h.src = "img/home/数字"+h+".png";
							}
							_hh.src = "img/home/数字"+hh+".png";
						}
						_mm.src = "img/home/数字"+mm+".png";
					}
					_m.src = "img/home/数字"+m+".png";
				}
				_ss.src = "img/home/数字"+ss+".png";
			}
			i--;
		},1000)
	})(0,1,2,5,4,5)
}])
//以上是倒计时效果结束
//===============
.controller("hiddenController",["$scope",function($scope){
	$scope.flag = false
}])
